#pragma once
#include "../common/tcp_base_common_type.h"
#include "send_packet_stream.h"
#include "../tcp_server_base/tcp_server_base.h"

class send_packet_t
{
public:
	send_packet_t(tcp_server_base_t& server);
	~send_packet_t();

	template<typename data_t>
	send_packet_t& operator<<(data_t const& t)
	{
		(*stream_) << packet_id << protocol;

		return *this;
	}

	bool send(connection_t const* conn);

private:
	tcp_server_base_t& server_;
	send_packet_stream::ptr stream_;
	send_packet_t(send_packet_t const& other);
};